import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  //H5 history模式
  mode: 'history',
  routes: [
	    {
	      path: '/',
	      name:'index',
	      component: function (resolve) {require(['../components/Hello'], resolve)}//按需加载组件    	
		},
    {
        path: '/test',
        name:'test',
        component: function (resolve) {require(['../components/Test'], resolve)}//按需加载组件     
    },
    {
        path: '/test1',
        name:'test1',
        component: function (resolve) {require(['../components/test1'], resolve)}//按需加载组件     
    },
    {
        path: '/register',
        name: 'register',
        component: function (resolve) {require(['../components/Register'], resolve)}
    },
    {
        path: '/paydeposit',
        name: 'paydeposit',
        component: function (resolve) {require(['../components/paydeposit'], resolve)}
    },
    {
        path: '/protocol',
        name: 'protocol',
        component: function (resolve) {require(['../components/protocol'], resolve)}
    },
    {
        path: '/home',
        name: 'home',
        component: function (resolve) {require(['../components/home'], resolve)}
    },
    {
    		path: '/orderdetail',
        name: 'orderdetail',
        component: function (resolve) {require(['../components/orderdetail'], resolve)}
    },
    {
    		path: '/orderlist',
        name: 'orderlist',
        component: function (resolve) {require(['../components/orderlist'], resolve)},
    },
    {
    		path: '/settlement',
        name: 'Settlement',
        component: function (resolve) {require(['../components/Settlement'], resolve)}
    },
    {
    		path: '/logdetails',
        name: 'logdetails',
        component: function (resolve) {require(['../components/logdetails'], resolve)}
    },
    {
    		path: '/mycard',
        name: 'mycard',
        component: function (resolve) {require(['../components/mycard'], resolve)}
    },
    {
    		path: '/myalipay',
        name: 'myalipay',
        component: function (resolve) {require(['../components/myalipay'], resolve)}
    },
    {
    		path: '/addcard',
        name: 'myalipay',
        component: function (resolve) {require(['../components/addcard'], resolve)}
    },
    {
    		path: '/personcenter',
        name: 'personcenter',
        component: function (resolve) {require(['../components/personcenter'], resolve)}
    },
    {
    		path: '/setting',
        name: 'setting',
        component: function (resolve) {require(['../components/setting'], resolve)}
    },
    {
    		path: '/information',
        name: 'information',
        component: function (resolve) {require(['../components/information'], resolve)}
    },
    {
    		path: '/Feedback',
        name: 'Feedback',
        component: function (resolve) {require(['../components/Feedback'], resolve)}
    },
    {
    		path: '/notification',
        name: 'notification',
        component: function (resolve) {require(['../components/notification'], resolve)}
    },
    {
    		path: '/forgetpass',
        name: 'forgetpass',
        component: function (resolve) {require(['../components/forgetpass'], resolve)}
    },
    {
    		path: '/changepass',
        name: 'changepass',
        component: function (resolve) {require(['../components/changepass'], resolve)}
    }
	],
  scrollBehavior (to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      return { x: 0, y: 0 }
    }
    if (to.hash) {
      return {
        selector: to.hash
    }
  }
  }
})
